package com.cloudm.technician.extensions

import android.os.Environment
import java.io.File

/**
 * 作者: wesley
 * 时间: 2017/12/22
 * 描述: sdcard相关的扩展函数
 */

/**
 * sdCard是否可用
 */
fun isSDCardEnable(): Boolean {
    return Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()
}

/**
 * 获取sd卡路径
 */
fun getSDCardPath(): String? {
    return when (isSDCardEnable()) {
        true -> Environment.getExternalStorageDirectory().path + File.separator
        else -> null
    }
}